package com.tjbklx1.pattern.specification.demo3;

public abstract class CompositeSpecification implements IUserSpecification {
	/**
	 * 是否满足条件由实现类实现
	 */
	public abstract boolean isSatisfiedBy(User user);

	/**
	 * and操作
	 */
	public IUserSpecification and(IUserSpecification spec) {
		return new SpecificationAnd(this, spec);
	}

	/**
	 * not操作
	 */
	public IUserSpecification not() {
		return new SpecificationNot(this);
	}

	/**
	 * or操作
	 */
	public IUserSpecification or(IUserSpecification spec) {
		return new SpecificationOr(this, spec);
	}
}